using System;
using OrderManager.Domain.Repositories;

namespace OrderManager.Domain.Entities
{
    /// <summary>
    /// Provides some common properties for used entities
    /// </summary>
    public abstract class EntityBase
    {
        /// <summary>
        /// Initialized a new instance of <see cref="OrderManager.Domain.Entities.EntityBase"/> class
        /// </summary>
        protected EntityBase()
        {
        }

        /// <summary>
        /// Initialized a new instance of <see cref="OrderManager.Domain.Entities.EntityBase"/> class with specified id
        /// </summary>
        /// <param name="id">Id of initialising instance</param>
        protected EntityBase(int id) : this()
        {
            Id = id;
        }

        /// <summary>
        /// Gets a new instanse of type that implements <see cref=" OrderManager.Domain.Repositories.IRepositoryFactory"/> interface
        /// </summary>
        protected IRepositoryFactory RepositoryFactory
        {
            get { return DomainContext.Instance.RepositoryFactory; }
        }

        /// <summary>
        /// Represents repository primary key id
        /// </summary>
        public Int32 Id { get; protected set; }
    }
}